package com.atguigu.boot.activemq.topic.consumer;


import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.TextMessage;

/**
 * @Auther 赵乾坤
 * @Date 2021-04-17 15:49
 */
@Component
public class Topic_Consumer {

    @JmsListener(destination = "${myTopic}")
    public void receive(TextMessage text)  {
        try {
            System.out.println("*******消费者收到订阅的主题：" + text.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }

}
